/**
 * 
 */
package edu.pku.sei.modeler.figures;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;

/**
 * @author YanYan
 *
 */
public class TerminatePseudostateFigure extends CommonFigure {

	public static final org.eclipse.swt.graphics.Color ACTIVITY_COLOR = new Color(null,175,178,239);
	
	private IFigure toolTip;
	
	public TerminatePseudostateFigure(){
		
		super();

		toolTip = new Label("Terminate");
		setToolTip(toolTip);
	}
	
	public void paint(Graphics graphics) {
		graphics.pushState();
		graphics.setAntialias(SWT.ON);
		Rectangle figureArea = getBounds();
		
		graphics.setForegroundColor(ColorConstants.buttonDarkest);
		
		int width = figureArea.width;
		int height = figureArea.height;
		
		Point leftUp = new Point(figureArea.x, figureArea.y);
		Point rightDown = new Point(figureArea.x+width, figureArea.y+height);
		Point leftDown = new Point(figureArea.x, figureArea.y+height);
		Point rightUp = new Point(figureArea.x+width, figureArea.y);
		
		graphics.drawLine(leftUp, rightDown);
		graphics.drawLine(leftDown, rightUp);

		graphics.popState();
	}
	
	public void setBounds(Rectangle rect) {
		super.setBounds(rect);
//		if (root != null)
//			root.setSize(rect.width, rect.height);
	}
	protected void paintShadow(Graphics g) {
		// TODO: draw the figure's own shadow here
	}
	
}
